<template>
	<view class="padding-0 margin-0" >
		<view v-if="!title" >
			<slot></slot>
		</view>
		<uni-collapse v-else-if="collapse" :accordion="true">
			<uni-collapse-item :title="title" show-animation :showIconText="true" :length="length" :showLength="showLength">
				<slot></slot>
			</uni-collapse-item>
		</uni-collapse>
		<om-sub v-else-if="!issub" :title="title" :required="required" :subTitle="subTitle"
		:showButton="showButton"  :buttonText="buttonText" @buttonLink='buttonLink'
		>
			<slot></slot>
		</om-sub>
		<uni-card v-else :titleUnderline="false" :is-full="true" style="border: none;border-radius: 1px;" titleBgColor="#eee" 
		 :title="title+'(' + order + ')'" :note="subTitle">
			<slot></slot>
		 </uni-card>
	</view>
</template>

<script>
	export default {
		props: {
			//标题
			title: {
				type: String,
				default() {
					return "";
				}
			},
			//副标题
			subTitle: {
				type: String,
				default() {
					return "";
				}
			},
			//是否子表
			issub: {
				type: Boolean,
				default() {
					return false;
				}
			},
			//子表序号
			order:{
				type: [Number,String],
				default() {
					return '';
				}
			},
			collapse:{
				type: Boolean,
				default() {
					return false;
				}
			},
			required:{
				type: Boolean,
				default() {
					return false;
				}
			},
			length:{
				type:Number,
				default(){
					return 0;
				}
			},
			showLength:{
				type:Boolean,
				default(){
					return false;
				}
			},
			showButton:{
				type:Boolean,
				default(){
					return false;
				}
			},
			buttonText:{
				type:String,
				default(){
					return "";
				}
			}
		},
		data() {
			return {
				
			}
		},
		methods: {
			buttonLink(){
				let _that = this
				_that.$emit("buttonLink")
			}
		}
	}
</script>

<style>

</style>
